package com.xthink.web.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.xthink.common.pojo.iPackage.CustomSpecsHistory;
import com.xthink.common.vo.iPackage.CustomPackagePageVo;
import com.xthink.common.result.AjaxResult;
import com.xthink.web.mapper.CustomSpecsHistoryMapper;
import com.xthink.web.service.CustomSpecsHistoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CustomSpecsHistoryServiceImpl extends ServiceImpl<CustomSpecsHistoryMapper, CustomSpecsHistory> implements CustomSpecsHistoryService {

    @Autowired
    private CustomSpecsHistoryMapper customSpecsHistoryMapper;

    //自定义套餐规格历史价格
    @Override
    public AjaxResult listCustomSpecsPrice(CustomPackagePageVo customPackagePageVo) {
        Page<CustomSpecsHistory> page = new Page<>(customPackagePageVo.getPage(),customPackagePageVo.getSize());
        LambdaQueryWrapper<CustomSpecsHistory> wrapper = new LambdaQueryWrapper<>();
        wrapper.eq(CustomSpecsHistory::getSpecsId,customPackagePageVo.getId());
        Page<CustomSpecsHistory> customSpecsHistoryPage = customSpecsHistoryMapper.selectPage(page, wrapper);
        List<CustomSpecsHistory> customSpecsHistory = customSpecsHistoryPage.getRecords();

        return AjaxResult.success("查询成功",customSpecsHistory);
    }

    //标准套餐规格历史价格
    @Override
    public AjaxResult listPipSpecsPrice(CustomPackagePageVo customPackagePageVo) {
        Page<CustomSpecsHistory> page = new Page<>(customPackagePageVo.getPage(),customPackagePageVo.getSize());
        LambdaQueryWrapper<CustomSpecsHistory> wrapper = new LambdaQueryWrapper<>();
        wrapper.eq(CustomSpecsHistory::getSpecsId,customPackagePageVo.getId());
        Page<CustomSpecsHistory> customSpecsHistoryPage = customSpecsHistoryMapper.selectPage(page, wrapper);
        List<CustomSpecsHistory> customSpecsHistory = customSpecsHistoryPage.getRecords();

        return AjaxResult.success("查询成功",customSpecsHistory);
    }
}
